﻿using Agile.Infra.Pay.WxPay;
using Microsoft.Extensions.Configuration;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class ServiceCollectionExtension
    {
        public static IServiceCollection AddWxPay(this IServiceCollection services, IConfiguration section)
        {
            if (services.HasRegistered(nameof(AddWxPay)))
                return services;
             
            services.Configure<WxPayOptions>(section.GetSection("WxPay"));
            services.AddTransient<IWxPayService, WxPayService>();
            return services;
        }
    }
}
